//
//  KefuViewController.m
//  zuixin
//
//  Created by QJY on 14-8-22.
//  Copyright (c) 2014年 dingshenwangluokeji. All rights reserved.
//

#import "KefuViewController.h"
#import "Header.h"
@interface KefuViewController ()

@end

@implementation KefuViewController
{
    UILabel *_label;
    NSArray *_ard;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.title=@"客服热线";
    self.view.backgroundColor =[UIColor whiteColor];
    UIImageView *imageView =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"LOGO.png"]];
    imageView.frame =CGRectMake(120, 30 ,90, 90);
    [self.view addSubview:imageView];
    
    _ard =[NSArray arrayWithObjects:@"客服热线:",@"4008067010", nil];
    for(int i=0;i<2;i++)
    {
        _label =[[UILabel alloc]initWithFrame:CGRectMake(0, 140+30*i, 320, 30)];
        _label.textAlignment=1;
        _label.textColor=[UIColor grayColor];
        _label.font=[UIFont systemFontOfSize:18];
        _label.text =[_ard objectAtIndex:i];
        [self.view addSubview:_label];
    }
    UIButton *btn =[UIButton buttonWithType:UIButtonTypeCustom];
    btn.backgroundColor =[UIColor redColor];
    btn.frame =CGRectMake(50, 240,220 ,50);
    btn.titleLabel.textAlignment=1;
    
    btn.titleLabel.font=[UIFont systemFontOfSize:22];
    [btn setTitle:@"马上拨打" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    btn.titleLabel.textColor=[UIColor blackColor];
    [btn setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
    [self.view addSubview:btn];
    UIButton *btn1 =[UIButton buttonWithType:UIButtonTypeCustom];
    btn1.titleLabel.textColor=[UIColor redColor];
    btn1.frame =CGRectMake(50, 280,220 ,40);
    btn1.titleLabel.textAlignment=1;
    btn1.backgroundColor =[UIColor redColor];
    btn1.titleLabel.font=[UIFont systemFontOfSize:22];
    [btn1 setTitle:@"取消" forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(btnClick1) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn1];
}
-(void)btnClick:(UIButton*)sender
{
   [sender setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    NSLog(@"d");
    NSString *phoneNum=_ard[1];
    NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNum]];
    NSLog(@"%@",phoneURL);
    [[UIApplication sharedApplication]openURL:phoneURL];
}
-(void)btnClick1
{
    [self dismissViewControllerAnimated:YES completion:^void{
        [self.view removeFromSuperview];
    }];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
